
<%@ page import="org.gtesoreria.Prestamo" %>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="layout" content="main" />
        <g:set var="entityName" value="${message(code: 'prestamo.label', default: 'Prestamo')}" />
        <title>Prestamo</title>
        <modalbox:modalIncludes />
    </head>
    <body>
        <div class="nav" style="display:none">
            <span class="menuButton"><a class="home" href="${createLink(uri: '/')}"><g:message code="default.home.label"/></a></span>
            <span class="menuButton"><g:link class="list" action="list"><g:message code="default.list.label" args="[entityName]" /></g:link></span>
            <span class="menuButton"><g:link class="create" action="create"><g:message code="default.new.label" args="[entityName]" /></g:link></span>
        </div>
        <div class="body">
        	<g:if test="${prestamoInstance == null}">
        		<br/><h3>${afiliado?.apellidoNombre }  no posee prestamo alguno</h3>
        	</g:if>
        	<g:if test="${prestamoInstance}">
        	
            <h1>Prestamo de ${prestamoInstance?.afiliado?.apellidoNombre }</h1>
            <g:if test="${flash.message}">
            <div class="message">${flash.message}</div>
            </g:if>
            <div class="dialog">
                <table>
                    <tbody>
                    
                        <tr class="prop">
                            <td valign="top" class="name"><g:message code="prestamo.afiliado.label" default="Afiliado" /></td>
                            
                            <td valign="top" class="value"><g:link controller="afiliado" action="show" id="${prestamoInstance?.afiliado?.id}">${prestamoInstance?.afiliado?.apellidoNombre}</g:link></td>
                            
                        </tr>
                    
                        <tr class="prop">
                            <td valign="top" class="name"><g:message code="prestamo.cuotas.label" default="Cuotas" /></td>
                            
                            <td valign="top" style="text-align: left;" class="value">
                                <modalbox:createLink url="/GTesoreria/prestamo/verCuotas?prestamoId=${prestamoInstance.id}" title="Cuotas" width="500">Ver Cuotas</modalbox:createLink>
                               
                            </td>
                            
                        </tr>
                    
                        <tr class="prop">
                            <td valign="top" class="name"><g:message code="prestamo.fechaOtorgamiento.label" default="Fecha Otorgamiento" /></td>
                            
                            <td valign="top" class="value"><g:formatDate date="${prestamoInstance?.fechaOtorgamiento}" format="MM-yyyy"/></td>
                            
                        </tr>
                    
                        <tr class="prop">
                            <td valign="top" class="name"><g:message code="prestamo.montoTotal.label" default="Monto Total" /></td>
                            
                            <td valign="top" class="value"><g:formatNumber number="${prestamoInstance.montoTotal}" type="number" minFractionDigits="2" maxFractionDigits ="2" roundingMode="HALF_UP" /></td>
                            
                        </tr>
                        
                        <tr class="prop">
                            <td valign="top" class="name"><g:message code="prestamo.pendiente.label" default="Pendiente" /></td>
                            
                            <td valign="top" class="value"><g:formatNumber number="${prestamoInstance.pendiente}" type="number" minFractionDigits="2" maxFractionDigits ="2" roundingMode="HALF_UP" /></td>
                            
                        </tr>
                    
                        <tr class="prop">
                            <td valign="top" class="name"><g:message code="prestamo.observaciones.label" default="Observaciones" /></td>
                            
                            <td valign="top" class="value">${fieldValue(bean: prestamoInstance, field: "observaciones")}</td>
                            
                        </tr>
                        
                        <tr class="prop">
                            <td valign="top" class="name"><g:message code="prestamo.observaciones.label" default="Cantidad de cuotas" /></td>
                            
                            <td valign="top" class="value">${prestamoInstance?.cuotas?.size()}</td>
                            
                        </tr>
                        
                        <tr class="prop">
                            <td valign="top" class="name"><g:message code="prestamo.observaciones.label" default="Monto de cada Cuota" /></td>
                            
                            <td valign="top" class="value">${prestamoInstance?.montoCuota}</td>
                            
                        </tr>
                    
                    </tbody>
                </table>
            </div>
            <div class="buttons" style="display:none">
                <g:form>
                    <g:hiddenField name="id" value="${prestamoInstance?.id}" />
                    <span class="button"><g:actionSubmit class="edit" action="edit" value="${message(code: 'default.button.edit.label', default: 'Edit')}" /></span>
                    <span class="button"><g:actionSubmit class="delete" action="delete" value="${message(code: 'default.button.delete.label', default: 'Delete')}" onclick="return confirm('${message(code: 'default.button.delete.confirm.message', default: 'Are you sure?')}');" /></span>
                </g:form>
            </div>
            </g:if>
        </div>
    </body>
</html>
